<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>搜索</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/AdminLTE-2.3.11/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="/AdminLTE-2.3.11/dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="/AdminLTE-2.3.11/dist/css/skins/_all-skins.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <div th:insert="/fragments/header :: header"></div>

    <div th:insert="/fragments/sidebar :: sidebar"></div>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <form role="form" th:action="@{/admin/search/} + ${typeid}" th:object="${goods}" method="post">
                    <div class="col-md-1 col-sm-6 col-xs-12">
                        <input type="text" name="gname" class="form-control" placeholder="名称">
                    </div>
                    <!-- /.col -->
                    <div class="col-md-1 col-sm-6 col-xs-12">
                        <input type="text" name="brand" class="form-control" placeholder="品牌">
                    </div>
                    <div th:switch="${typeid}">
                        <div th:case="1">
                            <!-- /.col -->
                            <div class="col-md-1 col-sm-6 col-xs-12">
                                <input type="text" name="color" class="form-control" placeholder="颜色">
                            </div>
                            <!-- /.col -->
                            <div class="col-md-1 col-sm-6 col-xs-12">
                                <input type="text" name="size" class="form-control" placeholder="大小">
                            </div>
                            <!-- /.col -->
                            <div class="col-md-2 col-sm-6 col-xs-12">
                                <input type="text" name="crowd" class="form-control" placeholder="适合人群">
                            </div>
                        </div>
                        <div th:case="2">
                            <!-- /.col -->
                            <div class="col-md-2 col-sm-6 col-xs-12">
                                <input type="date" name="deadline" class="form-control" placeholder="保质期截止日期">
                            </div>
                            <!-- /.col -->
                            <div class="col-md-1 col-sm-6 col-xs-12">
                                <input type="text" name="provenance" class="form-control" placeholder="产地">
                            </div>
                        </div>
                    </div>
                    <div class="col-md-2 col-sm-6 col-xs-12">
                        <input type="date" name="starttime" class="form-control" placeholder="起始日期">
                    </div>
                    <div class="col-md-2 col-sm-6 col-xs-12">
                        <input type="date" name="endtime" class="form-control" placeholder="截止日期">
                    </div>
                     <!--/.col-->
                    <div class="col-md-2 col-sm-6 col-xs-12">
                        <button type="submit" class="btn btn-default">搜索</button>
                    </div>
                    <!-- /.col -->
                </form>
            </div>
            <!-- /.row -->
            <br>
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header">
                            <h3 class="box-title">搜索结果</h3>
                        </div>
                        <!-- /.box-header -->
                        <div th:switch="${method}">
                            <div th:case="post" class="box-body table-responsive no-padding">
                                <table class="table table-hover">
                                    <tr>
                                        <th>名称</th>
                                        <th>品牌</th>
                                        <div th:switch="${typeid}">
                                            <div th:case="1">
                                                <th>颜色</th>
                                                <th>大小</th>
                                                <th>适合人群</th>
                                            </div>
                                            <div th:case="2">
                                                <th>保质期截止日期</th>
                                                <th>产地</th>
                                            </div>
                                        </div>
                                        <th>价格</th>
                                        <th>数量</th>
                                        <th>销售数量</th>
                                        <th>销售金额</th>
                                        <th>状态</th>
                                        <th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;管理</th>
                                    </tr>
                                    <tr th:each="goods : ${list}">
                                        <td th:text="${goods.gname}"></td>
                                        <td th:text="${goods.brand}"></td>
                                        <div th:switch="${typeid}">
                                            <div th:case="1">
                                                <td th:text="${goods.color}"></td>
                                                <td th:text="${goods.size}"></td>
                                                <td th:text="${goods.crowd}"></td>
                                            </div>
                                            <div th:case="2">
                                                <td th:text="${#dates.format(goods.deadline, 'yyyy-MM-dd')}"></td>
                                                <td th:text="${goods.provenance}"></td>
                                            </div>
                                        </div>
                                        <td th:text="${goods.price}"></td>
                                        <td th:text="${goods.count}"></td>
                                        <td th:text="${goods.saleCount}"></td>
                                        <td th:text="${goods.saleAmount}"></td>
                                        <div th:switch="${goods.status}">
                                            <td th:case="1"><span class="label label-primary">上架</span></td>
                                            <td th:case="0"><span class="label label-danger">下架</span></td>
                                        </div>
                                        <td>
                                            <div th:switch="${goods.status}">
                                                <div th:case="1">
                                                    <a th:href="@{/admin/goods/stock/} + ${goods.gid}"><span class="badge bg-green"> 进货</span></a>
                                                    <a th:href="@{/admin/undercarriage/goods/} + ${goods.gid}"><span class="badge bg-red"> 下架</span></a>
                                                </div>
                                                <div th:case="0">
                                                    <a th:href="@{/admin/goods/stock/} + ${goods.gid}"><span class="badge bg-green"> 进货</span></a>
                                                    <a th:href="@{/admin/undercarriage/recovery/goods/} + ${goods.gid}"><span class="badge bg-light-blue"> 恢复</span></a>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        <!-- /.box-body -->
                    </div>
                    <!-- /.box -->
                </div>
            </div>
            <!-- /.row -->
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    <div th:insert="/fragments/footer :: footer"></div>
</div>
<!-- ./wrapper -->

<!-- jQuery 2.2.3 -->
<script src="/AdminLTE-2.3.11/plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="/AdminLTE-2.3.11/bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="/AdminLTE-2.3.11/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="/AdminLTE-2.3.11/plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="/AdminLTE-2.3.11/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="/AdminLTE-2.3.11/plugins/fastclick/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="/AdminLTE-2.3.11/dist/js/app.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="/AdminLTE-2.3.11/dist/js/demo.js"></script>
</body>
</html>
